from django.contrib import admin
from django.utils.translation import ugettext, ugettext_lazy as _
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.forms import UserChangeForm
from people.models import Student, Teacher, Employee, Laptop #,Principal

class PersonAdmin(UserAdmin):
	foo = 'bar'

class StudentChangeForm(UserChangeForm):
	class Meta:
		model = Student	

class StudentAdmin(UserAdmin):
	fieldsets = (
		(None, {'fields': ('username', 'password')}),
		(_('Personal info'), {'fields': ('first_name', 'last_name', 'email', 'scholar_class')}),
		(_('Permissions'), {'fields': ('laptop', 'is_active')}),
		(_('Important dates'), {'fields': ('last_login', 'date_joined')}),
	)
	form = StudentChangeForm
	list_display = ('username', 'email', 'first_name', 'last_name', 'laptop')
	list_filter = ('scholar_class',)
	search_fields = ('username', 'first_name', 'last_name', 'email', 'laptop')
	ordering = ('first_name', 'last_name',)

class EmployeeAdmin(PersonAdmin):
	foo = 'bar'

class TeacherChangeForm(UserChangeForm):
	class Meta:
		model = Teacher	

class TeacherAdmin(UserAdmin):
	fieldsets = (
		(None, {'fields': ('username', 'password')}),
		(_('Personal info'), {'fields': ('first_name', 'last_name', 'email')}),
		(_('Permissions'), {'fields': ('scholar_classes', 'groups', 'is_active', 'is_staff', )}),
		(_('Important dates'), {'fields': ('last_login', 'date_joined')}),
	)
	form = TeacherChangeForm
	list_display = ('username', 'email', 'first_name', 'last_name', )
	list_filter = ('scholar_classes', )
	search_fields = ('username', 'first_name', 'last_name', 'email')
	ordering = ('first_name', 'last_name',)

'''
class PrincipalAdmin(TeacherAdmin):
	foo = 'bar'
'''

admin.site.register(Student, StudentAdmin)
admin.site.register(Employee, EmployeeAdmin)
admin.site.register(Teacher, TeacherAdmin)
#admin.site.register(Principal, PrincipalAdmin)
admin.site.register(Laptop)
